package design2.builder.example.components;

import design2.builder.example.cars.Car;

/**
 * 车载电脑
 */
public class TripComputer {
	private Car car;

	public void setCar(Car car) {
		this.car = car;
	}

	/**
	 * 显示燃油液位
	 */
	public void showFuelLevel(){
		System.out.println("燃油位："+car.getFuel());
	}

	/**
	 * 显示状态
	 */
	public void showStatus(){
		if(this.car.getEngine().isStarted()){
			System.out.println("车已经启动");
		}else{
			System.out.println("车未启动");
		}
	}
}
